﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Connect_to_SQL_Server_using_ADO.NET
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //IUnityContainer container = new UnityContainer();

            //SqlConnection cs = new SqlConnection(@"Data Source=(localdb)\V11.0;Initial Catalog=testdb001;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False");
            //container.RegisterInstance<SqlConnection>(cs);

            //container.RegisterType<IContactsRepository, SqlClientContactsRepository>(new ContainerControlledLifetimeManager());

            SqlConnection cs = new SqlConnection(@"Data Source=(localdb)\V11.0;Initial Catalog=testdb001;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False");
            IContactsRepository contactsRepository = new SqlClientContactsRepository( cs);
            Application.Run(new Form1(contactsRepository));   
        }
    }
}
